GtkRange: Add a style class during dragging
authorMatthias Clasen <mclasen@redhat.com>
Sun, 5 Oct 2014 21:29:32 +0000 (17:29 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 21 Oct 2014 03:07:45 +0000 (23:07 -0400)
This will be used to identify a scrollbar is being dragged - we
don't actually need the style class; another way to keep track
of the dragging status would be ok too.

gtk/gtkrange.c

index 496f9c1abac9e3ea2a87a40516f3bfc6d0eb58b4..62801c5f0bc7563ceb3b9d4c548821e275e3864c 100644 (file)
@@ -2257,6 +2257,9 @@ range_grab_add (GtkRange      *range,
                 MouseLocation  location)
 {
   GtkRangePrivate *priv = range->priv;
+  GtkStyleContext *context;
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (range));
 
   /* Don't perform any GDK/GTK+ grab here. Since a button
    * is down, there's an ongoing implicit grab on
@@ -2267,6 +2270,8 @@ range_grab_add (GtkRange      *range,
 
   if (gtk_range_update_mouse_location (range))
     gtk_widget_queue_draw (GTK_WIDGET (range));
+
+  gtk_style_context_add_class (context, "dragging");
 }
 
 static void
@@ -2291,6 +2296,9 @@ range_grab_remove (GtkRange *range)
 {
   GtkRangePrivate *priv = range->priv;
   MouseLocation location;
+  GtkStyleContext *context;
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (range));
 
   location = priv->grab_location;
   priv->grab_location = MOUSE_OUTSIDE;
@@ -2301,6 +2309,8 @@ range_grab_remove (GtkRange *range)
 
   update_zoom_state (range, FALSE);
   range->priv->zoom_set = FALSE;
+
+  gtk_style_context_remove_class (context, "dragging");
 }
 
 static GtkScrollType